<?php

namespace app\company\model;

use app\common\model\BaseModel;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use think\model\relation\HasMany;

class CompanyMenu extends BaseModel
{
    /**
     * 获取父级菜单信息
     * @param $pid
     * @return array|mixed
     * @throws DataNotFoundException
     * @throws DbException
     * @throws ModelNotFoundException
     */
    public function getPidMenu($pid): mixed
    {
        return $this->find($pid);
    }

    public function authMenu(): HasMany
    {
        return $this->hasMany(CompanyAuthMenu::class, 'company_menu_id', 'id');
    }
}